#include "gtest/gtest.h"
#include "Entities/dummy.h"
#include "entitymanager.h"
#include "Game/Game.h"
#include "Entities/linkmanager.h"
#include "Skills/link.h"
#include <memory>

using namespace std;

TEST(basic_test, entity_name) {
    unique_ptr<EntityManager> em(new EntityManager());
    Entity *dummy = em->get<entity::Dummy>();
    EXPECT_EQ(dummy->prefix, "_Entity_Actor_Dummy_");
}

TEST(basic_test, entity_id) {
    unique_ptr<EntityManager> em(new EntityManager());
    Entity *dummy = em->get<entity::Dummy>();
    EXPECT_EQ(dummy->id, dummy->prefix + "0");
}

TEST(basic_test, entity_test) {
    unique_ptr<EntityManager> em(new EntityManager());
    Entity *dummy = em->get<entity::Dummy>(), *dummy2 = em->get<entity::Dummy>();
    EXPECT_EQ(dummy->prefix, "_Entity_Actor_Dummy_");
    dummy->properties["hp"] = to_string(40);
    EXPECT_EQ(dummy2->id, dummy->prefix + "1");
    EXPECT_EQ(dummy2->properties["hp"], to_string(50));
    EXPECT_EQ(em->findEntityByID(dummy->prefix + "0")->properties["hp"], to_string(40));
}

TEST(basic_test, entity_manager_clear_test) {
    unique_ptr<EntityManager> em(new EntityManager());
    Entity *dummy = em->get<entity::Dummy>();
    EXPECT_EQ(dummy->id, dummy->prefix + "0");
    em = move(unique_ptr<EntityManager>(new EntityManager()));
    dummy = em->get<entity::Dummy>();
    EXPECT_EQ(dummy->id, dummy->prefix + "0");
}

